<!-- 地球物理测点-点 -->
<template>
  <el-drawer v-model="addDrawer" size="45%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading"
              v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="140px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="测点编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入测点编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线编号" prop="svyLineId">
            <el-input v-model="form.svyLineId" placeholder="请输入测线编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="野外编号" prop="fieldId" style="width: 100%">
            <el-input v-model="form.fieldId" placeholder="请输入野外编号" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea"
              show-word-limit maxlength="50" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探测方法" prop="svyMethod">
            <dict-select code="GeophySvyMethod-CVD" :value="form.svyMethod" @update="updateDict('svyMethod', $event)"></dict-select>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测点描述" prop="svyPointDescription" style="width: 100%">
            <dict-select code="SurveyPointTypeCVD" :value="form.svyPointDescription" @update="updateDict('svyPointDescription', $event)"></dict-select>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测点桩号" prop="milestoneNum">
            <el-input v-model="form.milestoneNum" placeholder="请输入测点桩号" maxlength="4" clearable></el-input>
          </el-form-item>
          <el-form-item label="测点经度" prop="lon">
            <el-input v-model="form.lon" placeholder="请输入测点经度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测点纬度" prop="lat">
            <el-input v-model="form.lat" placeholder="请输入测点纬度" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="高程 [米]" prop="elevation">
            <el-input v-model="form.elevation" placeholder="请输入高程 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="拐点标注名称" prop="labelInfo" style="width: 100%">
            <el-input v-model="form.labelInfo" placeholder="请输入拐点标注名称" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea"
              show-word-limit maxlength="50" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="备注" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { eightDouble, fourInt } from '@/utils/validate'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, updateDict, isShowSave } = useSpatialData()
const formRules = {
  id: [{ required: true, message: '请填写测点编号！', trigger: 'blur' }],
  milestoneNum: [fourInt],
  lon: [eightDouble],
  lat: [eightDouble],
  elevation: [eightDouble]
}
</script>
<style scoped></style>